const co=require('co')

function asyncFunction(num){
    return new Promise((resolve,reject)=>{
        setTimeout(()=>{
            resolve(num*2)
        },1000)
    })
}

function* generatorFunction(){
    const result1=yield asyncFunction(1)
    const result2=yield asyncFunction(2)
    return result1+result2
}
co(generatorFunction)
.then((res)=>{
    console.log(res)
})